package com.wjv.example.spbt.task.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * <p>Title: RestTempConfig</p>
 *
 * @author wjv
 * @date 2021/4/22 11:23
 * @description
 */
@Configuration
public class RestTemplateConfig {

    @Bean
    public RestTemplate myRestTemplate() {
        SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
        clientHttpRequestFactory.setReadTimeout(30 * 1000);
        clientHttpRequestFactory.setConnectTimeout(30 * 1000);
        return new RestTemplate(clientHttpRequestFactory);
    }
}
